<template>
  <TCollapse title="单项工程列表">
    <accButton :prj-id="prjId" :select-list="selectList" :btn-list="btnOptions" @getTable="getTable" />
    <accTable :table-header="tableHeader" :table-data="tableData" @changeCheck="handleCheck" @changeData="handleData" />
    <pagination
      :is-popper-body="false"
      :total="total"
      :page.sync="params.pageNum"
      :limit.sync="params.pageSize"
      @pagination="getTable"
    />
  </TCollapse>
</template>
<script>
import accButton from '@/views/acceptance/components/accButton.vue'
import { Mixins } from '@/views/acceptance/components/minix'
import accTable from '../table.vue'
import { tableMinix } from '@/views/acceptance/components/tableMinix'
export default {
  name: 'Plan',
  components: { accButton, accTable },
  mixins: [Mixins, tableMinix],
  data() {
    return {
      btnList_: ['materialBinding', 'materialService', 'serviceEdit', 'entering', 'apply', 'panorama']
    }
  },
  computed: {
    // 单项工程 智联项目
    getShowOne() {
      return this.newPrjDetail.manageMode === '31' && this.newPrjDetail.isNewBusiness === '1'
    },
    // 代建服务 代建类
    getShowTwo() {
      return this.newPrjDetail.prjType === 'Q' && this.newPrjDetail.buildModes === '07'
    },
    // 服务成本 设备录入
    getShowThree() {
      return this.newPrjDetail.prjType === 'W' && this.newPrjDetail.buildModes === '26'
    },
    btnList() {
      const btn = ['serviceEdit']
      const btns = ['materialBinding', 'materialService', 'serviceEdit'] // 服务成本设备录入不涉及
      // 单项工程 智联项目
      // 单项工程 智联项目 代建服务
      if (this.newPrjDetail.ifNewStartupProcess === '0' && this.getShowOne && (this.getShowTwo || this.getShowThree)) {
        return this.getShowThree ? this.btnList_.filter(item => !(btns.includes(item))) : this.btnList_.filter(items => !(btn.includes(items)))
      } else {
        return this.btnList_
      }
    }

  }
}
</script>

<style scoped lang='scss'></style>
